package com.fanshuai.jmx.jvm;

import java.lang.management.ClassLoadingMXBean;
import java.lang.management.CompilationMXBean;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;

public class RuntimeReporter {
    public static void init() {
        RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();

        System.out.println(runtimeMXBean.getBootClassPath());
        System.out.println(runtimeMXBean.getLibraryPath());

        //即时编译
        CompilationMXBean compilationMXBean = ManagementFactory.getCompilationMXBean();
        System.out.println(compilationMXBean.getTotalCompilationTime());

        //class loading
        ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();
        System.out.println(classLoadingMXBean.getLoadedClassCount());
        System.out.println(classLoadingMXBean.getUnloadedClassCount());
    }
}
